﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OLMS.DAL;
using OLMS.BLL;

namespace OLMS.Admin
{
    public partial class RolesManager : System.Web.UI.Page
    {
       
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RoleBinder();
            }
        }

        private void RoleBinder()
        {
            List<Roles> list = RoleBLL.GetRolesList();
            repRolesList.DataSource = list;
            repRolesList.DataBind();
        }     

        protected void btnRemove_Command(object sender, CommandEventArgs e)
        {
            int roleId = Convert.ToInt32(e.CommandArgument);
            if (RoleBLL.RemoveRole(roleId))
            {
                RoleBinder();
            }
        }

    }
}